extends Node2D

onready var animation_player := $AnimationPlayer


onready var yu1: RigidBody2D = $"雨水"
onready var yu2: RigidBody2D = $"雨水2"
onready var yu3: RigidBody2D = $"雨水3"
onready var yu4: RigidBody2D = $"雨水4"

func _process(delta: float) -> void:
	if randf() < 0.5 * delta and not animation_player.is_playing():
		animation_player.play("下雨", -1, rand_range(1, 8))

func xia_yu1():
	var node: RigidBody2D = yu1.duplicate()
	node.mode = RigidBody2D.MODE_RIGID
	add_child(node)
	node.modulate = Color.white
	node.set_collision_mask_bit(2, true)

func xia_yu2():
	var node: RigidBody2D = yu2.duplicate()
	node.mode = RigidBody2D.MODE_RIGID
	add_child(node)
	node.modulate = Color.white
	node.set_collision_mask_bit(2, true)
	
func xia_yu3():
	var node: RigidBody2D = yu3.duplicate()
	node.mode = RigidBody2D.MODE_RIGID
	add_child(node)
	node.modulate = Color.white
	node.set_collision_mask_bit(2, true)
	
func xia_yu4():
	var node: RigidBody2D = yu4.duplicate()
	node.mode = RigidBody2D.MODE_RIGID
	add_child(node)
	node.modulate = Color.white
	node.set_collision_mask_bit(2, true)
